package com.aspose.cells;

import java.util.ArrayList;

final class zatz {
   static void a(zif var0, com.aspose.cells.b.a.b.zp[] var1) throws Exception {
      if (var1[0].e() > 0 && var1[0].f() > 0) {
         if (var0.M() == 45 || var0.M() == 48) {
            int var2 = var0.a();
            if (var0.b() < var2) {
               var2 = var0.b();
            }

            byte var3 = 6;
            int var4 = var3 + zbuk.a((double)((float)(var2 - 70) * 14.0F / 230.0F));
            if (var0.B().s()) {
               var1[0].a(var1[0].c() + var4);
               var1[0].b(var1[0].d() + var4);
               var1[0].c(var1[0].e() - 2 * var4);
               var1[0].d(var1[0].f() - 2 * var4);
            }

            a(var1, var0, var4);
         }
      }
   }

   static void a(com.aspose.cells.b.a.b.zp[] var0, zif var1, int var2) {
      double var3 = 0.1428571492433548D / Math.cos(0.17453292519943295D);
      double var5 = (double)var1.p() * 3.141592653589793D / 180.0D;
      double var7 = (double)var0[0].e() * (Math.sin(var5) + var3 * (double)var1.q() / 100.0D * Math.cos(var5));
      double var9 = (double)var0[0].f() / (Math.sin(var5) + var3 * (double)var1.q() / 100.0D * Math.cos(var5));
      if (var7 <= (double)var0[0].f()) {
         var0[0].a(var0[0].c() + var2);
         var0[0].b(var0[0].d() + var2);
         var0[0].c(var0[0].e() - 2 * var2);
         var0[0].d(var0[0].f() - 2 * var2);
         var7 = (double)var0[0].e() * (Math.sin(var5) + var3 * (double)var1.q() / 100.0D * Math.cos(var5));
         var0[0].b(zbuk.c((double)((float)var0[0].d() + (float)var0[0].f() / 2.0F) - var7 / 2.0D));
         var0[0].d(zbuk.c(var7));
      } else {
         var0[0].a(zbuk.c((double)((float)var0[0].c() + (float)var0[0].e() / 2.0F) - var9 / 2.0D));
         var0[0].c(zbuk.c(var9));
      }

      double var11 = (double)var0[0].e() * var3 * (double)var1.q() / 100.0D * Math.cos(var5);
      double var13 = var11 / (double)var0[0].f();
      var1.a((float)var13);
   }

   static void a(zn var0, zif var1) throws Exception {
      zbcp var2 = (zbcp)((zbcp)var1.z().j().get(0));
      zjf var3 = var2.D();
      Color[] var4 = new Color[var3.getCount()];

      for(int var5 = 0; var5 < var3.getCount(); ++var5) {
         zjd var6 = var3.b(var5);
         if (var2.H()) {
            var6.i().c(var1.g(var2.aw()).a(var5));
         } else {
            var6.i().c(var2.A().e());
         }

         var4[var5] = var6.i().e();
      }

      double[] var15 = new double[var3.getCount()];

      for(int var16 = 0; var16 < var3.getCount(); ++var16) {
         zjd var7 = var3.b(var16);
         var15[var16] = Math.abs(var7.v());
      }

      String[] var17 = new String[var3.getCount()];
      double var18 = 0.0D;

      int var9;
      for(var9 = 0; var9 < var3.getCount(); ++var9) {
         var18 += Math.abs(var3.a(var9).v());
      }

      for(var9 = 0; var9 < var3.getCount(); ++var9) {
         zjd var10 = var3.b(var9);
         double var11 = var10.v();
         double var13 = Math.abs(var11) / var18;
         var17[var9] = a(var2, var9, var13);
      }

      com.aspose.cells.b.a.b.zp var19 = var1.B().b;
      if (var1.M() == 48) {
         var19.b(var19.d() + 5);
         var19.d(var19.f() - 10);
      }

      var19 = a(var0, var2, var19, var15, var4, var17);
      var1.B().b = new com.aspose.cells.b.a.b.zp(var19.c(), var19.d(), var19.e(), var19.f());
      ziy.a(var0, var1.B());
      zaub var20 = new zaub((float)var19.c(), (float)var19.d(), (float)var19.e(), (float)var19.f(), var15, var4, var1.af(), var17, var3);
      var20.a(var2);
      var20.a(var0);
      var20.a(var0, var2);
   }

   private static String a(zbcp var0, int var1, double var2) {
      zif var4 = var0.v();
      zjd var5 = var0.D().b(var1);
      ArrayList var6 = var4.z().c();
      zbo var7 = var4.e();
      zpt var8 = var5.o();
      boolean var9 = var8.r();
      boolean var10 = var8.q();
      String var11 = var8.f() ? "" : var8.p();
      String var12 = "".equals(var8.p()) ? "0%" : var8.p();
      String var13 = var0.i();
      String var14 = var1 < var7.l.size() ? zpv.a(var4.al(), var7.l.get(var1), var11, var9) : "";
      String var15;
      if (var10) {
         var15 = var1 >= 0 && var1 < var6.size() ? ((zfo)var6.get(var1)).c() : "";
         boolean var16 = var1 >= 0 && var1 < var6.size() ? ((zfo)var6.get(var1)).b() : false;
         var14 = var1 >= 0 && var1 < var7.l.size() ? zpv.a(var4.al(), var7.l.get(var1), var15, var16) : "";
      }

      var15 = zpv.a(var4.al(), var5.v(), var11, var9);
      if (var10) {
         var15 = zpv.a(var4.al(), var5.v(), var5.z(), var5.A());
      }

      String var23 = zpv.a(var4.al(), var2, var12, var9);
      String var17 = var8.l();
      com.aspose.cells.b.a.b.zg var18 = var8.a().h();
      int var19 = var8.m();
      int var20 = var8.n();
      int var21 = var8.o();
      String var22 = "";
      if (var8.h()) {
         var22 = var22 + var13;
      }

      if (var8.d()) {
         if (!"".equals(var22)) {
            var22 = var22 + var17;
         }

         var22 = var22 + var14;
      }

      if (var8.g()) {
         if (!"".equals(var22)) {
            var22 = var22 + var17;
         }

         var22 = var22 + var15;
      }

      if (var8.f()) {
         if (!"".equals(var22)) {
            var22 = var22 + var17;
         }

         var22 = var22 + var23;
      }

      return var22;
   }

   static com.aspose.cells.b.a.b.zp a(zn var0, zbcp var1, com.aspose.cells.b.a.b.zp var2, double[] var3, Color[] var4, String[] var5) throws Exception {
      zif var6 = var1.v();
      zjf var7 = var1.D();
      zaub var8 = new zaub((float)var2.c(), (float)var2.d(), (float)var2.e(), (float)var2.f(), var3, var4, var6.af(), var5, var7);
      var8.a(var1);
      new com.aspose.cells.b.a.b.zp();
      com.aspose.cells.b.a.b.zp var9 = var2;
      a(var0, var8);
      if (var1.v().B().q()) {
         com.aspose.cells.b.a.b.zt var10 = a(var2, var1);
         if (var10.b() > (float)var2.e() * 0.3F) {
            var10.a((float)var2.e() * 0.3F);
         }

         if (var10.c() > (float)var2.f() * 0.3F) {
            var10.b((float)var2.f() * 0.3F);
         }

         var2.a(var2.c() + (int)var10.b());
         var2.c(var2.e() - 2 * (int)var10.b());
         var2.b(var2.d() + (int)var10.c());
         var2.d(var2.f() - 2 * (int)var10.c());
         com.aspose.cells.b.a.b.zp[] var11 = new com.aspose.cells.b.a.b.zp[]{var2};
         a(var11, var6, 0);
         var9 = var11[0];
      }

      return var9;
   }

   private static ArrayList a(zn var0, zaub var1) throws Exception {
      com.aspose.cells.b.a.b.zv var2 = new com.aspose.cells.b.a.b.zv();
      var2.a(1);
      var2.c(1);
      zif var3 = var1.b().b();
      double var4 = 0.0D;
      double[] var6 = var1.a();
      int var7 = var6.length;

      int var8;
      for(var8 = 0; var8 < var7; ++var8) {
         double var9 = var6[var8];
         var4 += var9;
      }

      ArrayList var25 = new ArrayList();
      zauh[] var26 = var1.g();
      var8 = var26.length;

      for(int var27 = 0; var27 < var8; ++var27) {
         zauh var10 = var26[var27];
         if (var10 != null && var10.f().length() >= 1) {
            zjd var11 = var10.j();
            zbcp var12 = var11.g().a();
            zpt var13 = var11.o();
            double var14;
            if (var4 == 0.0D) {
               var14 = 0.0D;
            } else {
               var14 = Math.abs(var11.v()) / var4;
            }

            float var16;
            if (var3.B().q()) {
               if (var13.a().f().e()) {
                  var16 = (float)var3.a() * 0.175F;
               } else {
                  var16 = (float)var3.a() * 0.2F;
               }
            } else if (var13.a().f().e()) {
               var16 = (float)var3.a() * 0.175F;
            } else {
               var16 = (float)var3.a() * 0.2F;
            }

            float var17 = (float)var3.b();
            com.aspose.cells.b.a.b.zt var18 = zaue.a(var0, var3.z(), var12.ai(), var11.G(), var14, var16, var17, 0.0D);
            com.aspose.cells.b.a.b.zq var19 = com.aspose.cells.b.a.b.zq.c();
            float var20 = 0.0F;
            com.aspose.cells.b.a.b.zo var21;
            float[] var24;
            switch(var13.j()) {
            case 1:
               var24 = new float[]{var20};
               var21 = var10.a(0.25F, var24);
               var20 = var24[0];
               var21.a(var21.d() - var18.b() / 2.0F);
               var21.b(var21.e() - var18.c() / 2.0F);
               break;
            case 3:
               var24 = new float[]{var20};
               var21 = var10.a(0.5F, var24);
               var20 = var24[0];
               double var22 = (double)var20 * 3.141592653589793D / 180.0D;
               if (var20 > 270.0F || var20 < 90.0F) {
                  var21.a(var21.d() - (float)((double)var18.b() * Math.cos(var22)));
               }

               if (var20 > 0.0F && var20 < 180.0F) {
                  var21.b(var21.e() - (float)((double)var18.c() * Math.sin(var22)));
               }
               break;
            default:
               var24 = new float[]{var20};
               var21 = var10.a(0.5F, var24);
               var20 = var24[0];
               if ((double)var20 > 67.5D && (double)var20 < 112.5D) {
                  var21.a((float)((double)var21.d() - ((double)var20 - 67.5D) * (double)var18.b() / 45.0D));
               } else if ((double)var20 >= 112.5D && (double)var20 <= 247.5D) {
                  var21.a(var21.d() - var18.b());
               } else if ((double)var20 > 247.5D && (double)var20 < 292.5D) {
                  var21.a((float)((double)(var21.d() - var18.b()) + ((double)var20 - 247.5D) * (double)var18.b() / 45.0D));
               }

               if (var20 >= 0.0F && var20 <= 180.0F) {
                  var21.b(var21.e() + var10.h());
               } else if (var20 < 225.0F && var20 > 180.0F) {
                  var21.b(var21.e() - (var20 - 135.0F) * var18.c() / 90.0F);
               } else if (var20 >= 225.0F && var20 <= 315.0F) {
                  var21.b(var21.e() - var18.c());
               } else if (var20 > 315.0F && var20 <= 360.0F) {
                  var21.b(var21.e() - var18.c() + (var20 - 315.0F) * var18.c() / 90.0F);
               }
            }

            var19 = new com.aspose.cells.b.a.b.zq(var21, var18);
            var13.b = new com.aspose.cells.b.a.b.zq(var19.f(), var19.g(), var19.h(), var19.i());
            com.aspose.cells.b.a.a.ze.a(var25, (Object)var19);
         }
      }

      return var25;
   }

   private static com.aspose.cells.b.a.b.zt a(com.aspose.cells.b.a.b.zq var0, zbcp var1) {
      com.aspose.cells.b.a.b.zt var2 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);

      for(int var3 = 0; var3 < var1.D().getCount(); ++var3) {
         zjd var4 = var1.D().b(var3);
         zpt var5 = var4.o();
         if (var5.j() == 0 || var5.j() == 4 || var5.j() == 9) {
            com.aspose.cells.b.a.b.zt[] var6 = new com.aspose.cells.b.a.b.zt[]{var2};
            a(var0, var5.b, var6);
            var2 = var6[0];
         }
      }

      return var2;
   }

   private static com.aspose.cells.b.a.b.zt a(com.aspose.cells.b.a.b.zp var0, zbcp var1) {
      com.aspose.cells.b.a.b.zq var2 = new com.aspose.cells.b.a.b.zq((float)var0.c(), (float)var0.d(), (float)var0.e(), (float)var0.f());
      return a(var2, var1);
   }

   private static void a(com.aspose.cells.b.a.b.zq var0, com.aspose.cells.b.a.b.zq var1, com.aspose.cells.b.a.b.zt[] var2) {
      if (var1 != null && !var1.n()) {
         float var3;
         if (var1.j() < var0.j()) {
            var3 = var0.j() - var1.j();
            if (var3 > var2[0].b()) {
               var2[0].a(var3);
            }
         }

         if (var1.l() > var0.l()) {
            var3 = var1.l() - var0.l();
            if (var3 > var2[0].b()) {
               var2[0].a(var3);
            }
         }

         if (var1.k() < var0.k()) {
            var3 = var0.k() - var1.k();
            if (var3 > var2[0].c()) {
               var2[0].b(var3);
            }
         }

         if (var1.m() > var0.m()) {
            var3 = var1.m() - var0.m();
            if (var3 > var2[0].c()) {
               var2[0].b(var3);
            }
         }

      }
   }
}
